<?php

namespace App\Models;


use Illuminate\Database\Eloquent\SoftDeletes;

class GiftLessonStudent extends BaseModels
{
    use SoftDeletes;

    protected $table = 'gift_lesson_students';
    protected $primaryKey = 'student_id';
    protected $dates = ['expired_at'];
    protected $fillable = ['student_id'];

    const SHARE_LESSON_COUNT = 5;
    const ACCEPT_LESSON_COUNT = 1;
    const GIFT_LESSON_COUNT = 2;

    const STATUS_LOCK = 0;
    const STATUS_UNLOCK = 1;

    public function shares()
    {
        return $this->hasMany(GiftLessonShare::class, 'student_id', 'student_id');
    }

    public function getStudentId()
    {
        return $this->student_id;
    }

    public function setStudentId($value)
    {
        $this->student_id = $value;
    }

    public function getLessonCount()
    {
        return $this->lesson_count;
    }

    public function increaseLessonCount($value = 1)
    {
        $this->lesson_count += $value;
    }

    public function getLastActiveLessonCount()
    {
        return $this->last_active_lesson_count;
    }

    public function setLastActiveLessonCount($value)
    {
        $this->last_active_lesson_count = $value;
    }

    public function getShareCount()
    {
        return $this->share_count;
    }

    public function increaseShareCount($value = 1)
    {
        $this->share_count += $value;
    }

    public function getAcceptedCount()
    {
        return $this->accepted_count;
    }

    public function increaseAcceptedCount($value = 1)
    {
        $this->accepted_count += $value;
    }

    public function getTotalGift()
    {
        return $this->total_gift;
    }

    public function increaseGift($value = 1)
    {
        $this->total_gift += $value;
    }

    public function getStatus()
    {
        return $this->status;
    }

    public function setStatus($value)
    {
        $this->status = $value;
    }
}